from django.urls import path
from .views import (
    LoginView, RegisterView, LogoutView, UserInfoView,
    UpdateProfileView, ChangePasswordView, UploadAvatarView,
    UserListView, UserCreateView, UserUpdateView, UserToggleStatusView,
    UserProfileView, UserDeleteView
)

urlpatterns = [
    path('login/', LoginView.as_view(), name='user-login'),
    path('register/', RegisterView.as_view(), name='user-register'),
    path('logout/', LogoutView.as_view(), name='user-logout'),
    path('info/', UserInfoView.as_view(), name='user-info'),
    path('profile/', UserProfileView.as_view(), name='user-profile'),  # 新增：获取当前用户详细信息包括角色
    path('profile/update/', UpdateProfileView.as_view(), name='update-profile'),
    path('password/change/', ChangePasswordView.as_view(), name='change-password'),
    path('avatar/upload/', UploadAvatarView.as_view(), name='upload-avatar'),
    
    # 用户管理相关路由
    path('management/list/', UserListView.as_view(), name='user-list'),
    path('management/create/', UserCreateView.as_view(), name='user-create'),
    path('management/<int:user_id>/update/', UserUpdateView.as_view(), name='user-update'),
    path('management/<int:user_id>/toggle-status/', UserToggleStatusView.as_view(), name='user-toggle-status'),
    path('management/<int:user_id>/delete/', UserDeleteView.as_view(), name='user-delete'),
]
